public class ArrayNeighbours {
    public static void main(String[] args) {

        int numberIndex = -1;
        int minimumDistance = Integer.MAX_VALUE;

        if (args.length == 0) {
            System.out.println(Messages.NO_SEQUENCE);
            System.exit(0);
        }

        for (int index = 0; index < args.length - 1; index++) {

            String numberString = args[index];
            String nextNumberString = args[index + 1];

            try {
                int number = Integer.parseInt(numberString);
                int nextNumber = Integer.parseInt(nextNumberString);
                int distance = Math.abs(number - nextNumber);

                if (distance < minimumDistance) {
                    minimumDistance = distance;
                    numberIndex = index;
                }
            } catch (NumberFormatException e) {
                System.out.println(Messages.NON_NUMERIC_SEQUENCE);
                System.exit(0);
            }

        }

        System.out.printf(Messages.NUMBER_INDEX_RESULT, numberIndex);
        System.out.printf(Messages.MINIMUM_DISTANCE_RESULT, minimumDistance);

    }
}
